home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Cog Script
- #
- # POW_POWER.COG
- #
- # POWERUP Script - Power Cell
- #
- # [YB, CYW, SRS]
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
-
-
- symbols
-
- thing powerup local
- thing player local
- thing sender local
-
- int bin=12 local
- sound pickupsnd=powerpu1.wav local
- sound respawnsnd=Activate01.wav local
- flex amount local
-
- int bin_contents=0 local
- int autoselect_weapon=-1 local
-
- message touched
- message taken
- message respawn
-
- end
-
- # ========================================================================================
-
- code
-
- touched:
- player = GetSourceRef();
-
- if (GetThingType(player) != 10) Return;
-
- if (GetInv(player, bin) < GetInvMax(player, bin))
- {
- TakeItem(GetSenderRef(), -1);
- call taken;
- }
-
- Return;
-
- # ........................................................................................
-
- taken:
- player = GetSourceRef();
- powerup = GetSenderRef();
-
- // Print("Power Cells");
- jkPrintUNIString(player, bin);
-
- // Do effects.
- PlaySoundLocal(pickupsnd, 1, 0, 0);
- AddDynamicTint(player, 0.0, 0.0, 0.2);
-
- // store the old bin contents
- bin_contents = GetInv(player, bin);
-
- // Increment powerup amount.
- ChangeInv(player, bin, 25.0);
-
- // Check for Auto Reload
- if(GetAutoReload() & 1)
- {
- if(!bin_contents)
- {
- if(!((GetAutoReload() & 2) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
- {
- // Try to autoselect and see if the best weapon is a power cell weapon
- autoselect_weapon = AutoSelectWeapon(player, 2);
- if((autoselect_weapon == 15) || (autoselect_weapon == 6) || (autoselect_weapon == 9))
- SelectWeapon(player, GetWeaponBin(autoselect_weapon));
- }
- }
- }
-
- Return;
-
- # ........................................................................................
-
- respawn:
- PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
-
- return;
-
- end
-
-